<?php include "coresection/connection.php";?>
<?php include "coresection/checkSession.php";?>
<?php include "coresection/order-list.php";?>
<?php include "coresection/department-list.php"?>
<?php include "coresection/search-admin.php";?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<?php include 'modules/head.php'; ?>


    <script language="javascript">
        function printdiv(printpage)
        {
            var newstr = printpage.innerHTML;
            var oldstr = document.body.innerHTML;
            document.body.innerHTML =newstr;
            window.print();
            document.body.innerHTML=oldstr;
            return false;
        }


        window.onload=function()
        {
            var bt=document.getElementById("bt");
            var div_print=document.getElementById("div_print");

        }


        function print_btn()
        {
            var bt=document.getElementById("bt");
            var div_print=document.getElementById("div_print");

            printdiv(div_print);

        }

    </script>





</head>

<body>
<?php include 'modules/topbar.php'; ?>

<div class="setup_area">
    <?include 'modules/sidebar-admin.php'?>

    <div class="header">
        <h1>订餐统计</h1>
        <?php include 'modules/header.php'; ?>
    </div>


    <div class="content_area">



<div class="main">

    <div class="content">
        1.部门和姓名只能选择一个，否则当部门和姓名不对应的时候结果为0
    </div>

    <form action="" method="post" autocomplete="off" enctype="multipart/form-data">
        部门：<select name="depart" class="depart">
            <option value="all">全部</option>
            <? for($n=0;$n<count($departmentStr);$n++){ ?>
                <option value="<?echo $departmentStr[$n]?>"><?echo $departmentStr[$n]?></option>
            <? } ?>
        </select>
 姓名：<select name="selectName" class="selectName">
            <option value="all">全部</option>
            <? for($u=0;$u<count($admin_user_name);$u++){ ?>
                <option   value="<?echo $admin_user_name[$u]?>" data-dapart="<?echo $admin_department[$u]?>"><?echo $admin_user_name[$u]?></option>
            <? } ?>
        </select>  <br />
        <div style="margin-top: 10px; height: 1px;"></div>
        就餐时间：<select name="year">
            <option value="<?echo date("Y",time())?>"><?echo date("Y",time())?></option>
            <option value="<?echo date("Y",time())-1?>"><?echo date("Y",time())-1?></option>
        </select>
        年
        <select name="month">
            <option value="<? echo date(m)?>" ><? echo date(m)?></option>
            <option value="01" class="month_1">01</option>
            <option value="02" class="month_2">02</option>
            <option value="03" class="month_3">03</option>
            <option value="04" class="month_4">04</option>
            <option value="05" class="month_5">05</option>
            <option value="06" class="month_6">06</option>
            <option value="07" class="month_7">07</option>
            <option value="08" class="month_8">08</option>
            <option value="09" class="month_9">09</option>
            <option value="10" class="month_10">10</option>
            <option value="11" class="month_11">11</option>
            <option value="12" class="month_12">12</option>
        </select>
        月
        <select name="days">
            <option value="<? echo date(d)?>" ><? echo date(d)?></option>
            <option value="0">全部</option>
            <option value="01">01</option><option value="02">02</option><option value="03">03</option>
            <option value="04">04</option><option value="05">05</option><option value="06">06</option>
            <option value="07">07</option><option value="08">08</option><option value="09">09</option>
            <option value="10">10</option><option value="11">11</option><option value="12">12</option>
            <option value="13">13</option><option value="14">14</option><option value="15">15</option>
            <option value="16">16</option><option value="17">17</option><option value="18">18</option>
            <option value="19">19</option><option value="20">20</option><option value="21">21</option>
            <option value="22">22</option><option value="23">23</option><option value="24">24</option>
            <option value="25">25</option><option value="26">26</option><option value="27">27</option>
            <option value="28">28</option><option value="29">29</option><option value="30">30</option>
            <option value="31">31</option>
        </select>
        日
        <select name="ats">
            <option value="0">全部</option>
            <option value="1">早</option>
            <option value="2">午</option>
            <option value="3">晚</option>
        </select>
        餐

        <br class="clearfloat" style="margin:15px 0; "/>
        <input type="submit" value="查看" class="layui-btn dingdantongji_btn" />
        <input name="print" type="button" id="bt" value="点击打印" class="layui-btn" onclick="print_btn()"/>

    </form>









<div class="printArea <?if($_SESSION['userterm']==1){?>caiwuShow<?}?>"  id="div_print" >

    <? $diliver=array_count_values($search_diliver);?>



 <div style="font-size:20px!important;">


<b><?echo $reStr?></b> 共<b style="color: #F00;"> <?echo $sum?> </b>
    条订餐记录


<div>
    <span>堂食餐数 : <?echo $diliver['堂食']?></span>
    <span style="padding-left: 25px;">配送餐数 : <?echo $diliver['配送']?></span>
</div>

     <?if($_SESSION['userterm']==1){?> 共<b style="color: #F00;" class="orderPriceB">
</b>元<?}?>
 </div>

<ul class="caise"></ul>








        <table cellspacing="0" cellpadding="0" border="0" class="checkTable  layui-table  admin_list_table">
            <thead>
            <tr>
                <td>用餐日期</td>
                <td>订餐会员号</td>
                <td>订餐人</td>
                <td>早/午/晚餐</td>
                <td>菜式</td>
                <td>预订份数</td>
                <td >就餐点</td>
                <td>总价</td>
            </tr>
            </thead>
            <tbody>
            <?php for($i=0;$i<$sum;$i++){?>
     <tr>
                    <td><? echo $search_date[$i] ?></td>
                    <td><? echo $search_user[$i] ?></td>
                    <td><? echo $search_user_name[$i] ?> </td>
                    <td><?switch($search_at[$i]){
                            case 1:
                                echo "早餐";
                                break;
                            case 2:
                                echo "午餐";
                                break;
                            case 3:
                                echo "晚餐";
                                break;
                        }
                        ?></td>
                    <td class="productId productId_<?echo $search_id[$i]?>" data-id="productId_<?echo $search_id[$i]?>"><?echo $search_name[$i]?></td>
                    <td><?echo $search_num[$i]?></td>
                    <td ><?echo $search_diliver[$i]?></td>
                    <td class="orderPriceTd"><?echo $search_price[$i]?></td>
                </tr>
            <? } ?>
            </tbody>
        </table>
    </div>
</div>
<br />
<br />
<br />
<br />

        <?php include 'modules/footer.php'; ?>
</body>
</html>